<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta
      name="viewport"
      content="width=device-width, initial-scale=1.0,maximum-scale=1,minimum-scale=1,user-scalable=no"
    />
    <title>13-随机显示图片</title>
    <style>
      * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
      }
    </style>
  </head>
  <body>
    <img src="" alt="" />
    <script>
      // 一定要去找 和之前类似 或者实现过的案例 
      let userNames = [
        './images/course01.png',
        './images/course02.png',
        './images/course03.png',
        './images/course04.png',
      ];
      let index = Math.round(Math.random() * 3);

      let img = document.querySelector('img');
      img.src = userNames[index];
    </script>
  </body>
</html>
